from pydantic import BaseModel
from typing import List, Optional
from datetime import datetime

class FaultDetail(BaseModel):
    id: int
    serial_number: Optional[str] = None
    device_name: str
    resource_pool: str
    phase: str
    fault_time: Optional[str] = None
    alarm_clear_time: Optional[str] = None
    device_category: str
    manufacturer: str
    component_type: str
    discovery_method: Optional[str] = None
    solution_record: Optional[str] = None
    is_domestic: str
    component_sn: Optional[str] = None

class FaultDetailCreate(BaseModel):
    serial_number: Optional[str] = None
    device_name: str
    resource_pool: str
    phase: str
    fault_time: Optional[str] = None
    alarm_clear_time: Optional[str] = None
    device_category: str
    manufacturer: str
    component_type: str
    discovery_method: Optional[str] = None
    solution_record: Optional[str] = None
    is_domestic: str
    component_sn: Optional[str] = None

class FaultCount(BaseModel):
    id: int
    phase: str
    hardware_resource_pool: str
    software_manufacturer: str
    fault_handling_count: int
    created_at: Optional[datetime] = None

class FaultCountCreate(BaseModel):
    phase: str
    hardware_resource_pool: str
    software_manufacturer: str
    fault_handling_count: int

class ManufacturerStat(BaseModel):
    id: int
    manufacturer: str
    device_type: str
    optical_module: int
    cpu_non_domestic: int
    cpu_domestic_hygon: int
    cpu_domestic_arm: int
    memory: int
    disk_non_domestic: int
    disk_domestic: int
    cache_disk: int
    backplane: int
    nic_non_domestic: int
    nic_domestic: int
    sensor: int
    riser_card: int
    pcie_card_non_domestic: int
    pcie_card_domestic: int
    motherboard: int
    power_supply: int
    raid_card_non_domestic: int
    raid_card_domestic: int
    fiber: int
    fan_non_domestic: int
    fan_domestic: int
    whole_machine: int
    total_count: int
    created_at: Optional[datetime] = None

class ManufacturerStatCreate(BaseModel):
    manufacturer: str
    device_type: str
    optical_module: int
    cpu_non_domestic: int
    cpu_domestic_hygon: int
    cpu_domestic_arm: int
    memory: int
    disk_non_domestic: int
    disk_domestic: int
    cache_disk: int
    backplane: int
    nic_non_domestic: int
    nic_domestic: int
    sensor: int
    riser_card: int
    pcie_card_non_domestic: int
    pcie_card_domestic: int
    motherboard: int
    power_supply: int
    raid_card_non_domestic: int
    raid_card_domestic: int
    fiber: int
    fan_non_domestic: int
    fan_domestic: int
    whole_machine: int
    total_count: int

class FaultDescription(BaseModel):
    id: int
    description: str
    created_at: Optional[datetime] = None